import { IPropertyItem } from "../types";
import { getAttrs } from './attr/attr';
import { getRemoveAttrs } from "./attr/remove";
import { getAddCmpntAttrs } from './attr/cmpnt';
import { getSwitchCmpnt } from './attr/switch';

import { ICmpnt } from 'xcore/cmpnt';
import { onReady } from "xcode/data"
export * from "./bind"
export * from "./event";
import loader from "./bind/bind.loader";

// 定义一个函数，用于构建组件的菜单属性
export const setCmpntProperties = (attrs: IPropertyItem[], cmpnt: ICmpnt, bizData: Record<string, any>) => {
    let setAttrs = () => {
        getAttrs(attrs, cmpnt, bizData);
        getAddCmpntAttrs(attrs, cmpnt, bizData);
        getSwitchCmpnt(attrs, cmpnt);
        getRemoveAttrs(attrs, cmpnt);
    }
    if (!loader.loaded) {
        onReady(setAttrs)
        return
    }
    setAttrs();


};